#include "file/Image.hpp"

Image::Image(Byte* imageData, unsigned int imageDataSize){
    this->image = QImage::fromData(imageData, imageDataSize);

}

Image::Image(QImage image){
    this->image = image;

}

void Image::addNote(unsigned short x, unsigned short y, QString initialText, QString proofreadingText){
    this->notes.push_back(Note(x, y, initialText, proofreadingText));

}

void Image::removeNote(Byte index){
    this->notes.removeAt(index);

}

void Image::setImage(QImage image){
    this->image = image;

}

void Image::setNoteX(Byte index, unsigned short x){
    Note* note = (Note*)&this->notes.at(index);
    note->setX(x);

}

void Image::setNoteY(Byte index, unsigned short y){
    Note* note = (Note*)&this->notes.at(index);
    note->setY(y);
    
}

void Image::setNoteInitialText(Byte index, QString initialText){
    Note* note = (Note*)&this->notes.at(index);
    note->setInitialText(initialText);

}

void Image::setNoteProofreadingText(Byte index, QString proofreadingText){
    Note* note = (Note*)&this->notes.at(index);
    note->setProofreadingText(proofreadingText);

}

QImage Image::getImage(){
    return this->image;

}

unsigned short Image::getWidth(){
    return this->image.width();

}

unsigned short Image::getHeight(){
    return this->image.height();

}

Note Image::getNote(Byte index){
    return this->notes.at(index);

}

Byte Image::getNotesCount(){
    return this->notes.size();

}

unsigned short Image::getNoteX(Byte index){
    Note* note = (Note*)&this->notes.at(index);
    return note->getX();

}

unsigned short Image::getNoteY(Byte index){
    Note* note = (Note*)&this->notes.at(index);
    return note->getY();

}

QString Image::getNoteInitialText(Byte index){
    Note* note = (Note*)&this->notes.at(index);
    return note->getInitialText();

}

QString Image::getNoteProofreadingText(Byte index){
    Note* note = (Note*)&this->notes.at(index);
    return note->getProofreadingText();

}
